import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    subtitle: 'Winter is coming!',
    footerContent: 'Star-war project ©2020 Created by SHI SHUO',
    aside: {
      collapsed: false
    }
  },
  mutations: {
    TOGGLE_COLLAPSED: (state) => {
      state.aside.collapsed = !state.aside.collapsed
    }
  },
  actions: {
    toggleCollapsed({ commit }) {
      commit('TOGGLE_COLLAPSED')
    }
  },
  modules: {
    app,
    settings,
    user
  },
  getters
})
